package com.candy.service.impl;

import com.candy.bean.UserInfo;
import com.candy.dao.UserInfoMapper;
import com.candy.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserInfoServiceImpl implements UserInfoService {
    @Autowired
    UserInfoMapper userInfoMapper;
    @Override
    public List<UserInfo> getUserInfo(UserInfo userInfo) {
        return userInfoMapper.getUserInfo(userInfo);
    }

    @Override
    public int editUserInfo(UserInfo userInfo) {
        if(userInfo.getId()!=null){
            return userInfoMapper.updateByPrimaryKeySelective(userInfo);
        }else {
            return userInfoMapper.insertSelective(userInfo);
        }
    }
}
